/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-05-28 08:38:34
 * @LastEditors: voanit
 * @LastEditTime: 2022-05-28 11:14:07
 */
/* 
1-注解
2-别名 type
3-interface
4-元祖
5-字面量类型
*/
export {}
type N = number
let n1: number = 123
let n2: number = 456
let n3: N = 666

type O = {
  id: number
  name: string
  f1?: (n) => void
  // f1(a): void
}
let obj: O = {
  id: 1,
  name: 'jack',
  // f1(a) {},
}

interface IO2 {
  id: number
  age: number
}
let obj2: IO2 = {
  id: 1,
  age: 18,
  // f1(a) {},
}

function useState(value: number): [number, (number) => number] {
  // return [count, setCount]
  const setVale = (value) => value
  return [value, setVale]
}
//  const  [val,setVal] =useState(10)

// 字面量类型
let name: 'jack' = 'jack'
const name2 = 'rose'

type Gender = '男' | '女'

function Person(gender: Gender): Gender {
  return gender
}
console.log(Person('男'))
